import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import request from '@/utils/request'
import '@/icons' // icon
import '@/permission' // permission control
import * as directives from './directives'
// import PageTools from '@/components/PageTools'
import Components from '@/components/index'
import * as filters from '@/filters'
import Print from 'vue-print-nb'
Vue.use(Print)
Vue.use(Components)
Vue.use(ElementUI)
// Vue.component('PageTools', PageTools)
Vue.config.productionTip = false

Vue.prototype.$request = request

// 1.使用for in来批量注册全局指令
// for (const key in directives) {
//   console.log(key)
//   Vue.directive(key, directives[key])
// }

// 2.使用Object keys来批量注册全局指令
Object.keys(directives).forEach(key => Vue.directive(key, directives[key]))
Object.keys(filters).forEach(key => Vue.filter(key, filters[key]))
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
